﻿<%@ Page MasterPageFile="~/MasterPage.master" Language="C#" AutoEventWireup="true"
    CodeFile="ExportExcel.aspx.cs" Inherits="Print_ExportExcel" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script language="javascript" src="../resources/scripts/checks.js"></script>
    <script language="JavaScript" src="../resources/scripts/empchecks.js"></script>
    <script language="javascript" type="text/javascript">
        function winopen(url, width, height) {
            var newurl, arrurl;
            if (typeof (url) == "undefined" || url == "") {
                return;
            }
            else {
                if (url.indexOf("?") == -1) {
                    newurl = url;
                }
                else {
                    newurl = url.substring(0, url.indexOf("?") + 1);
                    arrurl = url.substring(url.indexOf("?") + 1).split("&");
                    for (var i = 0; i < arrurl.length; i++) {
                        newurl += arrurl[i].split("=")[0] + "=" + escape(arrurl[i].split("=")[1]) + "&";
                    }
                    newurl = newurl.substring(0, newurl.length - 1);
                }
            }
            if (typeof (width) != "number" || typeof (height) != "number") {
                location.href(newurl);
            }
            else {
                location.href(newurl, "", "width=" + width + ",height=" + height);
            }
        } 
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="wsd_inputtable" style="width: 100%">
        <tr>
            <td class="tabletitle">
                导出字段
            </td>
        </tr>
        <tr>
            <td>
                <asp:CheckBoxList ID="chkDataTable" runat="server" RepeatColumns="15" RepeatDirection="Horizontal">
                </asp:CheckBoxList>
            </td>
        </tr>
    </table>
    <table id="wsd_inputtable">
        <tr>
            <td class="tabletitle">
                操作选项
            </td>
        </tr>
        <tr>
            <td class="buttonarea">
                &nbsp&nbsp
                <asp:Button ID="txtExport" class="wsd_button2" runat="server" Text="导出Excel" OnClick="txtExport_Click" />
            </td>
        </tr>
    </table>
    <p>
    </p>
    <!----历史拜访详细记录------>
    <div id="divVisitDetail" runat="server" visible="false">
        <table id="wsd_inputtable" style="width: 100%">
            <tr>
                <td class="tabletitle" colspan="6">
                    导出详细信息
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    巡店督导:
                </td>
                <td nowrap="nowrap">
                    <asp:Label runat="server" ID="lblName" />
                </td>
                <td class="tablefield">
                    开始日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox ID="TxtStartDate" runat="server" Width="150"></asp:TextBox>
                </td>
                <td class="tablefield">
                    结束日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox ID="txtEndDate" runat="server" class="default" Width="150"></asp:TextBox>
                </td>
            </tr>
        </table>
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle">
                    操作选项
                </td>
            </tr>
            <tr>
                <td class="buttonarea">
                    <asp:Button ID="Button1" class="wsd_button2" runat="server" Text="基本数据" OnClick="txtExport0_Click"
                        Style="height: 21px" />
                    &nbsp&nbsp
                    <asp:Button ID="btn_Export" class="wsd_button2" runat="server" Text="详细数据-横向" OnClick="btn_Export_Click" />
                    &nbsp;&nbsp;
                    <asp:Button ID="btn_ExportZX" class="wsd_button2" runat="server" Text="详细数据-纵向" 
                        onclick="btn_ExportZX_Click"/>
                    &nbsp;&nbsp;
                    <asp:Button ID="btn_Export2" class="wsd_button2" runat="server" Text="活动点数" Onclick="btn_Export2_Click" />
                </td>
            </tr>
        </table>
    </div>
    <!----历史拜访详细记录------>
    <script type="text/javascript">
        /*  
        将Date/String类型,解析为String类型.  
        传入String类型,则先解析为Date类型  
        不正确的Date,返回 ''  
        如果时间部分为0,则忽略,只返回日期部分.  
        */
        function formatDate(v) {
            if (v instanceof Date) {
                var y = v.getFullYear();
                var m = v.getMonth() + 1;
                var d = v.getDate();
                var h = v.getHours();
                var i = v.getMinutes();
                var s = v.getSeconds();
                var ms = v.getMilliseconds();
                if (ms > 0)
                    return y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s
						+ '.' + ms;
                if (h > 0 || i > 0 || s > 0)
                    return y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;
                return y + '-' + m + '-' + d;
            }
            return '';
        }

        $(function () {
            $('#<%=TxtStartDate.ClientID %>').datebox({
                currentText: '今天',
                closeText: '关闭',
                disabled: false,
                required: true,
                missingMessage: '必填',
                formatter: formatDate
            });
        });
        $(function () {
            $('#<%=txtEndDate.ClientID %>').datebox({
                currentText: '今天',
                closeText: '关闭',
                disabled: false,
                required: true,
                missingMessage: '必填',
                formatter: formatDate
            });
        });
    </script>
</asp:Content>
